#! /usr/bin/env python
#coding=utf-8
def sayHello():
    '''The hello
    
    World'''
    print 'Hello World! This is a function !'
sayHello()
#parameter test
def getMax(a,b):
    if a>b:
        print a,'is maximum'
    else:
        print b,'is maximum'
getMax(3,222)
#variable test
def funct1(x):
    '''This is docstring test
    
    For the moment of joy
    '''
    print 'x is :',x
    x=2
    print 'has changed the x ',x
x=50
funct1(2)
print 'x is still ',x
#global test
def funct2():
    global x
    print 'x is ',x
    x=2
    print 'has changed x to ',x
x=80
funct2()
print 'x value is ',x
#default parameter
def say(msg,number=1):
    print msg*number
say("Hello")
say('I love you',5)
#key parameter test
def keyPar(a,b,c=9):
    print 'a is',a,' and b is ',b,' and c is ',c
keyPar(3,7)
keyPar(a=2,b=23)
#不能在keyword参数后跟非keyword参数 e.g keyPar(a=22,23)
keyPar(33,b=233,c=22)
keyPar(c=99,a=33,b=22)
